<?php


namespace app\admin\validate;


use think\Validate;

class Category extends Validate
{
    //字段规则
    protected $rule = [
        'nickname' => 'require|unique:category',
        'name' => 'require',
        'ids' => 'require'
    ];

    //验证器提示信息
    protected $message = [
        'nickname.require' => '请输入分类唯一标识',
        'nickname.unique' => '分类标识已存在',
        'id.require' => 'id不能为空',
    ];

    //使用场景
    protected $scene = [
        'add'  =>  ['nickname','name'],
        'edit'   => ['ids','nickname' => 'require'],
        'detail'   => ['ids'],
        'delete'   => ['ids'],
    ];
}